﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="discussionAdd.aspx.vb" Inherits="Web_2._0_BMW___X6_Experts_Web_Application.discussionAdd" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">

        .discussionInformation
        {
            height: 930px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p style="font-size: x-large; font-weight: bolder; text-decoration: underline;">
        BMW - X6 Discussion Forum</p>
    <div class="discussionInformation">
        <span class="st">Welcome to the BMW - X6 Forums at www.bmw-x6.co.uk. Post all of 
            your BMW - X6 related questions and receive answers from our users &amp; industry 
            experts.<br />
        <br />Thousands of our users login everyday to posts discussions and give answers too, 
            its free help and guidance only for you!!! 
            <br />
        <br />
            <div class = "instructions" style="font-size: medium; font-weight: bold; font-style: italic">
            
                To add a new discussion to this page, just enter the title of the discussion in the textbox below and 
                click &#39;Submit&#39;.
            
                <br />
            
            </div>
        <br />
        
        <div class = "addingNewDiscussion">
            <div class = "addingNewDiscussion2">
            
                <asp:TextBox ID="txtmaintenancedescription" runat="server" BorderStyle="Solid" 
                    Height="94px" TextMode="MultiLine" Width="434px" BorderColor="Silver"></asp:TextBox>
&nbsp;
                <asp:Button ID="btnsubmit" runat="server" Height="31px" Text="Submit" 
                    Width="121px" BackColor="#99CCFF" />
            
                <br />
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="txtmaintenancedescription" 
                    ErrorMessage="The discussion box is empty, please enter the title of a discussion and press submit." 
                    Font-Bold="True" Font-Italic="True" ForeColor="Red"></asp:RequiredFieldValidator>
            
            </div>
            </div>
        
        </span>
        <br />

        <div class = "discussion">
        
        
        
            <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" 
                style="font-size: small; font-family: Calibri">
                <AlternatingItemTemplate>
                        

                        <strong>Title:</strong>
                        <a href="postsAdd.aspx?id=<%# Eval("DiscussionID") %>"><asp:Label ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' /> </a>
                        <br />
                        <strong>Date Discussion Created:</strong>
                        <asp:Label ID="DateCreatedLabel" runat="server" 
                            Text='<%# Eval("DateCreated") %>' />
                        <br />
                        <strong>Created by:</strong>
                        <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>"><asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                        
                        <br />
                        <br />
                    </AlternatingItemTemplate>
                    <EditItemTemplate>
                        DiscussionID:
                        <asp:Label ID="DiscussionIDLabel1" runat="server" 
                            Text='<%# Eval("DiscussionID") %>' />
                        <br />
                        <strong>Title:</strong>
                        <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                        <br />
                        <strong>Date Discussion Created:</strong>
                        <asp:TextBox ID="DateCreatedTextBox" runat="server" 
                            Text='<%# Bind("DateCreated") %>' />
                        <br />
                        <strong>Created by:</strong>
                        <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>"><asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                        <br />
                        <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                            Text="Update" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                            Text="Cancel" />
                        <br />
                        <br />
                        </span>
                    </EditItemTemplate>
                    <EmptyDataTemplate>
                        <span>No data was returned.</span>
                    </EmptyDataTemplate>
                    <InsertItemTemplate>
                        DiscussionID:
                        <asp:Label ID="DiscussionIDLabel1" runat="server" 
                            Text='<%# Eval("DiscussionID") %>' />
                        <br />
                        <strong>Title:</strong>
                        <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                        <br />
                        <strong>Date Discussion Created:</strong>
                        <asp:TextBox ID="DateCreatedTextBox" runat="server" 
                            Text='<%# Bind("DateCreated") %>' />
                        <br />
                        <strong>Created by:</strong>
                        <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>"><asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                        <br />
                        <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                            Text="Update" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                            Text="Cancel" />
                        <br />
                        <br />
                        </span>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        

                        
                        <strong>Title:</strong>
                        <a href="postsAdd.aspx?id=<%# Eval("DiscussionID") %>"><asp:Label ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' /> </a>
                        <br />
                        <strong>Date Discussion Created:</strong>
                        <asp:Label ID="DateCreatedLabel" runat="server" 
                            Text='<%# Eval("DateCreated") %>' />
                        <br />

                        <strong>Created by:</strong>
                       <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>"><asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>

                        <br />
                        <br />
                        </span>
                    </ItemTemplate>
                    <LayoutTemplate>
                        <div ID="itemPlaceholderContainer" runat="server" 
                            style="font-family: Verdana, Arial, Helvetica, sans-serif;">
                            <span runat="server" id="itemPlaceholder" />
                        </div>
                         <div style="text-align: center;background-color: #CCCCCC; font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
                            <asp:DataPager ID="DataPager1" runat="server" PagedControlID="ListView1" PageSize="10">
                            
                                <Fields>
                                    <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                        ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                    <asp:NumericPagerField />
                                    <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                                        ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                </Fields>
                            </asp:DataPager>
                        </div>
                    </LayoutTemplate>
                    <SelectedItemTemplate>
                        <span style="background-color: #008A8C;color: #FFFFFF;">DiscussionID:
                        <asp:Label ID="DiscussionIDLabel1" runat="server" 
                            Text='<%# Eval("DiscussionID") %>' />
                        <br />
                        <strong>Title:</strong>
                        <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                        <br />
                        <strong>Date Discussion Created:</strong>
                        <asp:TextBox ID="DateCreatedTextBox" runat="server" 
                            Text='<%# Bind("DateCreated") %>' />
                        <br />
                        <strong>Created by:</strong>
                        <asp:TextBox ID="UserNameTextBox" runat="server" 
                            Text='<%# Bind("UserName") %>' />
                        <br />
                        <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                            Text="Update" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                            Text="Cancel" />
                        <br />
                        <br />
                        </span>
                    </SelectedItemTemplate>
            </asp:ListView>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
                
                
                SelectCommand="SELECT Discussion.DiscussionID, Discussion.Title, Discussion.DateCreated, aspnet_Users.UserName FROM (Discussion INNER JOIN aspnet_Users ON Discussion.UserIDFK = aspnet_Users.UserId) GROUP BY Discussion.Title, Discussion.DateCreated, Discussion.DiscussionID, aspnet_Users.UserName ORDER BY Discussion.DiscussionID DESC">
            </asp:SqlDataSource>
        
        </div>
      
        
        </div>
</asp:Content>
